import java.util.Set;
import java.text.ParseException;
import java.util.* ;
public class Check {
	private user user = new user();
	public Check(){}
	public Check(user user){
		this.user = user;
	}
	
	public int KeyRight(){
		if(user.getClass().equalsIgnoreCase(user.getPassword())){
			return 1;
		}
		else 
			return 0;
	}
	public int DateRight(){
		String pat="\\d{4}-\\d{2}-\\d{2}";
		if(user.getBirthday().matches(pat)){
			return 1;
		}
		else
			return 0;
		}
	public int EmailRight(){
		String ema = "\\w+@\\w+.(com|com.cn|cn|net|gov|edu|org)";
		if(user.email().matches(ema)){
			return 1;
		}
		else 
			return 0;
	}
	public int PhoneRight(){
		String ph = "[1][3578]+\\d{9}";                  
		if(user.getPhone().matches(ph)){
			return 1;
		}
		else 
			return 0;
	}
			
};